Skip to content

aclp region and group_by changes#807

Merged
yec-akamai merged 21 commits intolinode:mainfrom
pmajali:aclp-region
Nov 6, 2025
Merged

aclp region and group_by changes#807
yec-akamai merged 21 commits intolinode:mainfrom
pmajali:aclp-region

Conversation

@pmajali
Copy link
Contributor

@pmajali pmajali commented Aug 25, 2025

📝 Description

  1. Adding Monitor in the regions endpoint. This specifies the monitor services enabled in a particular region.
  2. Adding group_by and filters field to the dashboard widget.
  3. Enhancing services endpoint to include alert

✔️ How to Test

package main

import (
	"context"
	"fmt"
	"log"
	"net/http"
	"os"

	"github.com/linode/linodego"

	"golang.org/x/oauth2"
)

func main() {
	apiKey, ok := os.LookupEnv("LINODE_TOKEN")
	if !ok {
		log.Fatal("Could not find LINODE_TOKEN, please assert it is set.")
	}
	tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: apiKey})

	oauth2Client := &http.Client{
		Transport: &oauth2.Transport{
			Source: tokenSource,
		},
	}

	linodeClient := linodego.NewClient(oauth2Client)
	linodeClient.SetDebug(true)

	res, err := linodeClient.ListMonitorServices(context.Background(), nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%v", res)

	res, err := linodeClient.ListRegions(context.Background(), nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%v", res)
}

How do I run the relevant unit/integration tests?

unit tests
make test-unit TEST_ARGS="-run TestListMonitorServices"
make test-unit TEST_ARGS="-run TestListMonitorDashboards"
make test-unit TEST_ARGS="-run TestListRegions"

Integration test
make test-int TEST_ARGS="-run TestMonitorServices_Get_smoke"
make test-int TEST_ARGS="-run TestMonitorDashboards_Get_smoke"
make test-int TEST_ARGS="-run TestRegionsMonitorsSection"

@pmajali pmajali requested a review from a team as a code owner August 25, 2025 17:19
@pmajali pmajali requested review from lgarber-akamai and zliang-akamai and removed request for a team August 25, 2025 17:19
@pmajali
Copy link
Contributor Author

pmajali commented Sep 3, 2025

An integration test for region 'TestRegions_pgLimits' is failing because the code expects 'Placement Group' not to be present at index 0, which ideally is not the case. I'm not sure why it was written this way, so haven't modified it.

	regionIdx := slices.IndexFunc(regions, func(region linodego.Region) bool {
		return slices.Contains(region.Capabilities, "Placement Group")
	})
	require.NotZero(t, regionIdx)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the monitoring capabilities of the Linode API client by adding monitor services to region information and extending dashboard widget functionality. The changes support ACLP (Analytics, Control Plane) monitoring features.

  • Adds Monitors field to regions containing supported alert and metrics services
  • Extends dashboard widgets with group_by and filters fields for better data aggregation
  • Enhances monitor services to include alert configuration details

Reviewed Changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/unit/region_test.go Added tests for monitors field in region responses
test/unit/monitor_services_test.go Enhanced tests for alert details and fixed service type tests
test/unit/monitor_dashboards_test.go Added tests for group_by and filters widget fields
test/unit/fixtures/*.json Updated fixtures with monitors data, alert configurations, and widget fields
test/integration/regions_test.go Added integration test for monitors section validation
test/integration/monitor_services_test.go Enhanced service validation and test structure
test/integration/monitor_dashboards_test.go Added widget field validation for group_by and filters
test/integration/fixtures/*.yaml Updated integration fixtures with monitors data

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

pmajali and others added 6 commits September 4, 2025 09:19
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@yec-akamai
Copy link
Contributor

Can you please fix the lint issue reported by the workflow?

Copilot AI review requested due to automatic review settings September 23, 2025 12:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@linode linode deleted a comment from Copilot AI Sep 23, 2025
@linode linode deleted a comment from Copilot AI Sep 23, 2025
@yec-akamai
Copy link
Contributor

The lint issue is not fixed: https://github.com/linode/linodego/actions/runs/17945547628/job/51053708173?pr=807

Looks just some format issues. Could you run make lint locally to identify and fix the issues?

@pmajali
Copy link
Contributor Author

pmajali commented Sep 24, 2025

https://github.com/linode/linodego/actions/runs/17945547628/job/51053708173?pr=807

I dont see lint issues related to monitor changes.

@yec-akamai
Copy link
Contributor

https://github.com/linode/linodego/actions/runs/17945547628/job/51053708173?pr=807

I dont see lint issues related to monitor changes.

We recently updated the linter so it generated some new requirements. You can have them fixed by merging the main and fix the conflicts correspondingly.

Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@yec-akamai yec-akamai requested a review from Copilot October 9, 2025 16:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 20 out of 25 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 26 to 37
// GetMonitorServiceByType gets a monitor service by a given service_type
func (c *Client) GetMonitorServiceByType(ctx context.Context, serviceType string) (MonitorService, error) {
e := formatAPIPath("monitor/services/%s", serviceType)
return getPaginatedResults[MonitorService](ctx, c, e, opts)

result, err := doGETRequest[MonitorService](ctx, c, e)

if result == nil {
return MonitorService{}, err
}

return *result, err
}
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function now returns a single MonitorService instead of a list, but the API path and behavior should be validated. Consider documenting this breaking change from ListMonitorServiceByType to GetMonitorServiceByType in the commit message or PR description.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution more consistent with our standards would be to make this function return a pointer (*MonitorService) returning the results of doGETRequest directly 👍

Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thank you for the contribution!
Once #807 (comment) has been addressed this should be ready to go 🎉

@yec-akamai yec-akamai self-requested a review November 6, 2025 14:18
@yec-akamai yec-akamai merged commit 1da7c96 into linode:main Nov 6, 2025
10 checks passed
@ezilber-akamai ezilber-akamai added the new-feature for new features in the changelog. label Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants